/**
 * Project threadpoll
 * @author lwj
 */


#ifndef _TASKQUEUE_H
#define _TASKQUEUE_H
#include <queue>
#include <iostream>
#include <mutex>
#include <condition_variable>
using namespace std;
class Task;

class TaskQueue {
public: 
    
TaskQueue(size_t capacity);
    
~TaskQueue();
    
Task * pop();
    
/**
 * @param num
 */
void push(Task *);

    
bool empty();
    
bool full();

void wakeup();
private: 
    std::size_t _capacity;
    queue<Task *> _que;
    condition_variable _nopro;
    condition_variable _fullpro;
    mutex _mux;
    bool _flag;
};

#endif //_TASKQUEUE_H
